JavaScript

A5.u.math.polarresolve Method

Syntax

A5.u.math.polar.resolve(pointA,pointB)

Returns

polarobject

The resulting angle and distance

anglenumber

The angle in degrees.

distancenumber

The distance.

pointAobjectarray

The first point. Can be an array, or an object with properties "x" and "y".

pointBobjectarray

The point to transform. If no point is passed in then an x/y value of 0 will be used

Description

Calculate the polar angle and distance from two points.

Discussion

This method will calculate the angle and distance between two points. The points can be passed in as either an array where the first entry is the "x" value and the second entry is the "y", or and object with "x" and "y" properties.

Example

var p = A5.u.math.polar.resolve([0,0],[1,1]);
// p = {angle: 45, distance: 1.4142135623730951}